<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "orders".
 *
 * @property int $id
 * @property string $order_id 订单号：日期+6为随机
 * @property string $user_name 下单人名字
 * @property string $user_phone 用户手机号
 * @property string $user_id_number 身份证号
 * @property string $user_province 所在省市
 * @property string $user_address 所在街道
 * @property string $goods_id 商品ID
 * @property string $goods_name 商品名称
 * @property string $goods_order_thumbnail 订单缩略图(订单表的缩略图)
 * @property string $goods_order_attr 商品属性：下单时所选属性 (字符串拼接)
 * @property double $goods_price 商品总价（商品表价格）
 * @property double $goods_official_price 官方价格
 * @property double $order_money
 * @property double $order_monthly_rent 月租(每月价格）
 * @property double $order_gross_rent 总租金
 * @property string $order_tenancy_term 租期(月)
 * @property string $order_repay_period 剩余还款期数(未到期提前结清 该字段为0)
 * @property double $order_rema_amount_pay 剩余应还款金额
 * @property double $order_amount_actually_paid 实付金额：随用户付款而变动(应付金额+逾期金额)
 * @property double $order_amount_override 逾期金额
 * @property double $order_installation_charge 安装包金额
 * @property double $order_goods_insurance 意外保障费
 * @property string $zm_credit_score 芝麻信用分
 * @property double $zm_exempt_deposit (暂时没用)
 * @property string $zm_order_no 芝麻订单号
 * @property double $zm_credit_amount 芝麻信用免押金 (花呗信用额度抵扣)
 * @property string $electronic_contract_number 电子签章合同号(上上签)
 * @property string $order_create_time 下单时间
 * @property string $order_delivery_time 发货时间
 * @property string $order_entry_time 订单生效时间
 * @property string $order_receiv_time 收货时间
 * @property string $order_remarks 备注:（注释：1.当用户取消订单时维护取消原因 2.审核拒绝时维护拒绝原因 3.支付宝拒绝时添加支付宝拒绝原因）描述（异常退货或者提前结清时 添加描述）
 * @property string $describe 用于异步结果
 * @property string $order_comefrom 订单来源(H5_ZFB，XCX_ZFB，H5_JD）（H5支付宝,小程序支付宝，H5京东）
 * @property string $order_pay 支付方式：1支付宝代扣 2主动还款
 * @property string $order_status 订单状态：0.订单未完成 1.待审核 2.待发货 3.已发货 4.还款中 5.已完成 6.订单取消 7.拒绝 8.逾期中（逾期中：还款后状态更改未还款中或完成) 9 异常退货 10 交易关闭
 * @property string $express 快递公司
 * @property string $exp_number 快递单号
 * @property string $data3
 * @property int $is_delivery 郑投网  1否 2是
 * @property string $order_last_overdue 最后逾期时间
 * @property int $my_cou_id 我的优惠券表id
 * @property int $is_send_out 是否发过标  1否 2是
 * @property string $user_id_number_front 身份证正面
 * @property string $user_id_number_behind 身份证背面
 * @property int $risk_status 该订单是全部冻结还是一部分  1全部  2部分
 * @property double $amount_frozen 需冻结额度
 * @property string $area_code 区域代码
 * @property int $order_type 订单类型  1：分期购买  2：全款购买
 * @property int $is_relet  是否续租：1未续租；2续租    
 * @property int $starges_is_created 默认为0,已经生成账单为1
 * @property int $first_starges_is_pay 默认为0（未扣过），首期扣款成功1，扣款失败2，
 */
class Orders extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'orders';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['order_id', 'user_name', 'user_phone', 'user_id_number', 'user_province', 'user_address', 'goods_id', 'goods_name', 'goods_order_thumbnail', 'goods_order_attr', 'goods_price', 'order_monthly_rent', 'order_gross_rent', 'order_tenancy_term', 'order_repay_period', 'order_rema_amount_pay', 'order_amount_actually_paid', 'order_amount_override', 'order_installation_charge', 'zm_credit_score', 'zm_exempt_deposit', 'zm_credit_amount', 'electronic_contract_number', 'order_create_time', 'order_delivery_time', 'order_entry_time', 'order_receiv_time', 'order_remarks', 'order_comefrom', 'order_pay', 'order_last_overdue', 'amount_frozen'], 'required'],
            [['goods_price', 'goods_official_price', 'order_money', 'order_monthly_rent', 'order_gross_rent', 'order_rema_amount_pay', 'order_amount_actually_paid', 'order_amount_override', 'order_installation_charge', 'order_goods_insurance', 'zm_exempt_deposit', 'zm_credit_amount', 'amount_frozen'], 'number'],
            [['is_delivery', 'my_cou_id', 'is_send_out', 'risk_status', 'order_type', 'is_relet', 'starges_is_created', 'first_starges_is_pay'], 'integer'],
            [['order_id', 'user_id_number'], 'string', 'max' => 33],
            [['user_name'], 'string', 'max' => 23],
            [['user_phone'], 'string', 'max' => 11],
            [['user_province', 'zm_order_no', 'express', 'exp_number'], 'string', 'max' => 50],
            [['user_address', 'goods_name', 'goods_order_thumbnail', 'electronic_contract_number', 'order_remarks', 'order_comefrom', 'order_status'], 'string', 'max' => 100],
            [['goods_id', 'order_create_time', 'order_delivery_time', 'order_entry_time', 'order_receiv_time', 'order_last_overdue'], 'string', 'max' => 20],
            [['goods_order_attr'], 'string', 'max' => 120],
            [['order_tenancy_term', 'order_repay_period'], 'string', 'max' => 32],
            [['zm_credit_score'], 'string', 'max' => 22],
            [['describe'], 'string', 'max' => 200],
            [['order_pay', 'area_code'], 'string', 'max' => 30],
            [['data3'], 'string', 'max' => 255],
            [['user_id_number_front', 'user_id_number_behind'], 'string', 'max' => 60],
            [['order_id'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'order_id' => 'Order ID',
            'user_name' => 'User Name',
            'user_phone' => 'User Phone',
            'user_id_number' => 'User Id Number',
            'user_province' => 'User Province',
            'user_address' => 'User Address',
            'goods_id' => 'Goods ID',
            'goods_name' => 'Goods Name',
            'goods_order_thumbnail' => 'Goods Order Thumbnail',
            'goods_order_attr' => 'Goods Order Attr',
            'goods_price' => 'Goods Price',
            'goods_official_price' => 'Goods Official Price',
            'order_money' => 'Order Money',
            'order_monthly_rent' => 'Order Monthly Rent',
            'order_gross_rent' => 'Order Gross Rent',
            'order_tenancy_term' => 'Order Tenancy Term',
            'order_repay_period' => 'Order Repay Period',
            'order_rema_amount_pay' => 'Order Rema Amount Pay',
            'order_amount_actually_paid' => 'Order Amount Actually Paid',
            'order_amount_override' => 'Order Amount Override',
            'order_installation_charge' => 'Order Installation Charge',
            'order_goods_insurance' => 'Order Goods Insurance',
            'zm_credit_score' => 'Zm Credit Score',
            'zm_exempt_deposit' => 'Zm Exempt Deposit',
            'zm_order_no' => 'Zm Order No',
            'zm_credit_amount' => 'Zm Credit Amount',
            'electronic_contract_number' => 'Electronic Contract Number',
            'order_create_time' => 'Order Create Time',
            'order_delivery_time' => 'Order Delivery Time',
            'order_entry_time' => 'Order Entry Time',
            'order_receiv_time' => 'Order Receiv Time',
            'order_remarks' => 'Order Remarks',
            'describe' => 'Describe',
            'order_comefrom' => 'Order Comefrom',
            'order_pay' => 'Order Pay',
            'order_status' => 'Order Status',
            'express' => 'Express',
            'exp_number' => 'Exp Number',
            'data3' => 'Data3',
            'is_delivery' => 'Is Delivery',
            'order_last_overdue' => 'Order Last Overdue',
            'my_cou_id' => 'My Cou ID',
            'is_send_out' => 'Is Send Out',
            'user_id_number_front' => 'User Id Number Front',
            'user_id_number_behind' => 'User Id Number Behind',
            'risk_status' => 'Risk Status',
            'amount_frozen' => 'Amount Frozen',
            'area_code' => 'Area Code',
            'order_type' => 'Order Type',
            'is_relet' => 'Is Relet',
            'starges_is_created' => 'Starges Is Created',
            'first_starges_is_pay' => 'First Starges Is Pay',
        ];
    }
}
